package com.jefe.bamboo.service.model.impl;

import com.jefe.bamboo.service.model.UserPrefsBmb;
import com.jefe.bamboo.service.model.UserPrefsBmbSoap;

import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.model.impl.BaseModelImpl;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

import java.util.ArrayList;
import java.util.List;


/**
 * <a href="UserPrefsBmbModelImpl.java.html"><b><i>View Source</i></b></a>
 *
 * <p>
 * ServiceBuilder generated this class. Modifications in this class will be
 * overwritten the next time is generated.
 * </p>
 *
 * <p>
 * This class is a model that represents the <code>UserPrefsBmb</code> table
 * in the database.
 * </p>
 *
 * @author Brian Wing Shun Chan
 *
 * @see com.jefe.bamboo.service.model.UserPrefsBmb
 * @see com.jefe.bamboo.service.model.UserPrefsBmbModel
 * @see com.jefe.bamboo.service.model.impl.UserPrefsBmbImpl
 *
 */
public class UserPrefsBmbModelImpl extends BaseModelImpl<UserPrefsBmb> {
    public static final String TABLE_NAME = "UserPrefsBmb";
    public static final Object[][] TABLE_COLUMNS = {
            { "bmbHost", new Integer(Types.VARCHAR) },
            

            { "bmbPort", new Integer(Types.INTEGER) },
            

            { "bmbId", new Integer(Types.BIGINT) },
            

            { "bmbUser", new Integer(Types.VARCHAR) },
            

            { "bmbPass", new Integer(Types.VARCHAR) }
        };
    public static final String TABLE_SQL_CREATE = "create table UserPrefsBmb (bmbHost VARCHAR(75) null,bmbPort INTEGER,bmbId LONG not null primary key,bmbUser VARCHAR(75) null,bmbPass VARCHAR(75) null)";
    public static final String TABLE_SQL_DROP = "drop table UserPrefsBmb";
    public static final String DATA_SOURCE = "liferayDataSource";
    public static final String SESSION_FACTORY = "liferaySessionFactory";
    public static final String TX_MANAGER = "liferayTransactionManager";
    public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.entity.cache.enabled.com.jefe.bamboo.service.model.UserPrefsBmb"),
            true);
    public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.finder.cache.enabled.com.jefe.bamboo.service.model.UserPrefsBmb"),
            true);
    public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
                "lock.expiration.time.com.jefe.bamboo.service.model.UserPrefsBmb"));
    private String _bmbHost;
    private int _bmbPort;
    private long _bmbId;
    private String _bmbUser;
    private String _bmbPass;
    private transient ExpandoBridge _expandoBridge;

    public UserPrefsBmbModelImpl() {
    }

    public static UserPrefsBmb toModel(UserPrefsBmbSoap soapModel) {
        UserPrefsBmb model = new UserPrefsBmbImpl();

        model.setBmbHost(soapModel.getBmbHost());
        model.setBmbPort(soapModel.getBmbPort());
        model.setBmbId(soapModel.getBmbId());
        model.setBmbUser(soapModel.getBmbUser());
        model.setBmbPass(soapModel.getBmbPass());

        return model;
    }

    public static List<UserPrefsBmb> toModels(UserPrefsBmbSoap[] soapModels) {
        List<UserPrefsBmb> models = new ArrayList<UserPrefsBmb>(soapModels.length);

        for (UserPrefsBmbSoap soapModel : soapModels) {
            models.add(toModel(soapModel));
        }

        return models;
    }

    public long getPrimaryKey() {
        return _bmbId;
    }

    public void setPrimaryKey(long pk) {
        setBmbId(pk);
    }

    public Serializable getPrimaryKeyObj() {
        return new Long(_bmbId);
    }

    public String getBmbHost() {
        return GetterUtil.getString(_bmbHost);
    }

    public void setBmbHost(String bmbHost) {
        _bmbHost = bmbHost;
    }

    public int getBmbPort() {
        return _bmbPort;
    }

    public void setBmbPort(int bmbPort) {
        _bmbPort = bmbPort;
    }

    public long getBmbId() {
        return _bmbId;
    }

    public void setBmbId(long bmbId) {
        _bmbId = bmbId;
    }

    public String getBmbUser() {
        return GetterUtil.getString(_bmbUser);
    }

    public void setBmbUser(String bmbUser) {
        _bmbUser = bmbUser;
    }

    public String getBmbPass() {
        return GetterUtil.getString(_bmbPass);
    }

    public void setBmbPass(String bmbPass) {
        _bmbPass = bmbPass;
    }

    public UserPrefsBmb toEscapedModel() {
        if (isEscapedModel()) {
            return (UserPrefsBmb) this;
        } else {
            UserPrefsBmb model = new UserPrefsBmbImpl();

            model.setNew(isNew());
            model.setEscapedModel(true);

            model.setBmbHost(HtmlUtil.escape(getBmbHost()));
            model.setBmbPort(getBmbPort());
            model.setBmbId(getBmbId());
            model.setBmbUser(HtmlUtil.escape(getBmbUser()));
            model.setBmbPass(HtmlUtil.escape(getBmbPass()));

            model = (UserPrefsBmb) Proxy.newProxyInstance(UserPrefsBmb.class.getClassLoader(),
                    new Class[] { UserPrefsBmb.class },
                    new ReadOnlyBeanHandler(model));

            return model;
        }
    }

    public ExpandoBridge getExpandoBridge() {
        if (_expandoBridge == null) {
            _expandoBridge = new ExpandoBridgeImpl(UserPrefsBmb.class.getName(),
                    getPrimaryKey());
        }

        return _expandoBridge;
    }

    public Object clone() {
        UserPrefsBmbImpl clone = new UserPrefsBmbImpl();

        clone.setBmbHost(getBmbHost());
        clone.setBmbPort(getBmbPort());
        clone.setBmbId(getBmbId());
        clone.setBmbUser(getBmbUser());
        clone.setBmbPass(getBmbPass());

        return clone;
    }

    public int compareTo(UserPrefsBmb userPrefsBmb) {
        long pk = userPrefsBmb.getPrimaryKey();

        if (getPrimaryKey() < pk) {
            return -1;
        } else if (getPrimaryKey() > pk) {
            return 1;
        } else {
            return 0;
        }
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        UserPrefsBmb userPrefsBmb = null;

        try {
            userPrefsBmb = (UserPrefsBmb) obj;
        } catch (ClassCastException cce) {
            return false;
        }

        long pk = userPrefsBmb.getPrimaryKey();

        if (getPrimaryKey() == pk) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return (int) getPrimaryKey();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("{bmbHost=");
        sb.append(getBmbHost());
        sb.append(", bmbPort=");
        sb.append(getBmbPort());
        sb.append(", bmbId=");
        sb.append(getBmbId());
        sb.append(", bmbUser=");
        sb.append(getBmbUser());
        sb.append(", bmbPass=");
        sb.append(getBmbPass());
        sb.append("}");

        return sb.toString();
    }

    public String toXmlString() {
        StringBuilder sb = new StringBuilder();

        sb.append("<model><model-name>");
        sb.append("com.jefe.bamboo.service.model.UserPrefsBmb");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>bmbHost</column-name><column-value><![CDATA[");
        sb.append(getBmbHost());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>bmbPort</column-name><column-value><![CDATA[");
        sb.append(getBmbPort());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>bmbId</column-name><column-value><![CDATA[");
        sb.append(getBmbId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>bmbUser</column-name><column-value><![CDATA[");
        sb.append(getBmbUser());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>bmbPass</column-name><column-value><![CDATA[");
        sb.append(getBmbPass());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
